﻿<!-- #include file="cjconn.asp" -->
<!-- #include file="conn.asp" -->
<!-- #include file="cjf.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>网站管理员登陆</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="vv23com" name="Author">
    <link href="images/style.css" type="text/css" rel="stylesheet">
    <meta content="MSHTML 6.00.3790.0" name="GENERATOR">
</head>
<body>
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="2">
        <tr>
            <td>
                <%
Dim StarPage,EndPage,Co,Msg,Fid,ID,curl,urlname
dim datasave
Server.ScriptTimeOut=99999
datasave=Request("save")
curl=Request("curl")
urlname=Request("urlname")
comic_id=Request("comic_id")
comicname=Request("comicname")
zdid=request.QueryString("claid")
cjid1=request("cjid1")
cjid2=request("cjid2")
Co=Request("Co")
asppage=request("asppage")
indexurl=Request("indexurl")
picpj=Request("picpj")
If Co=0 Then
StarPage=2
EndPage=1
else
StarPage=Request("StarPage")
EndPage=Request("EndPage")
end if
ID=EndPage
If Co="" or Not IsNumeric(Co) Then Co=1
If curl="" Then
   Response.write "目标网址不能为空<br><A HREF=# onclick=""Javascript:history.back(-1)""><FONT  COLOR=#FF0000>请点这里返回</FONT></A>"
   Response.End
ElseIf Cint(StarPage)<Cint(EndPage) Then
   Response.write "您输入的起始ID小于结束ID <br><A HREF=# onclick=""Javascript:history.back(-1)""><FONT  COLOR=#FF0000>请点这里返回</FONT></A>"
   Response.End
End If


If StarPage=EndPage Then
   Msg=msg&"本章节采集完成!<br><br>"
   MusicMake
      if cjid1=cjid2 then
   Msg=msg&"全部章节采集完成!<br><br>"
      else
   MakeNextzj
   end if
Else
   Msg="正在取得远程HTML中,请等待......<br><br>"
   MusicMake
   MakeNextPage
End IF

Sub MusicMake
If Co=0 Then
else
Response.write "<b><font color=#FF0000>"&StarPage&"</font>/<font color=#FF0000>"&EndPage&"</font>&nbsp;&nbsp;"
Response.write Msg&"</b>"
end if
Response.write "<IE:Download ID=""oDownload"" STYLE=""behavior:url(#default#download)"" />"

MakeIMG
End Sub

Sub MakeIMG
Dim k:k=0
on error resume next
Response.write "<table border=0 width=100% height=300 align=center><tr>"
Response.write  "<td width=28% height=200 valign=top>"
if urlname="asp" then
url=curl&"&"&asppage&"="&EndPage
else
if cjid1<>"" then
cjid1=cjid1&"/"
end if
urlo=curl&cjid1&"[id]."
url=urlo&urlname
end if
set rs=server.CreateObject("ADODB.RecordSet")
Sql="Select top 1 * From const Where id="&zdid
Rs.Open Sql,Conn1,3,3
flashimg=rs("flashimg")
flashname=rs("flashname")
flashabout=rs("flashabout")
flashtype=rs("flashtype")
noflashimg=rs("noflashimg")
flashpath=rs("flashpath")
flashgamepath=rs("flashgamepath")
flashimgurl=rs("flashimgurl")
flashclass=rs("flashclass")
flashsize=rs("flashsize")
flashzz=rs("flashzz")
body=rs("body")
rs.close
set fs=nothing

url=bqtf1(url)
flashimg=bqtf1(flashimg)
flashname=bqtf1(flashname)
flashabout=bqtf1(flashabout)
flashtype=bqtf1(flashtype)
noflashimg=bqtf1(noflashimg)
flashpath=bqtf1(flashpath)
flashgamepath=bqtf1(flashgamepath)
flashimgurl=bqtf1(flashimgurl)
flashclass=bqtf1(flashclass)
flashsize=bqtf1(flashsize)
flashzz=bqtf1(flashzz)
body=bqtf1(body)

url1=Split(url,"[id]")
flashimg1=Split(flashimg,"$")
flashname1=Split(flashname,"$")
flashabout1=Split(flashabout,"$")
flashtype1=Split(flashtype,"$")
flashpath1=Split(flashpath,"$")
flashclass1=Split(flashclass,"$")
flaszz1=Split(flashzz,"$")
flashsize1=Split(flashsize,"$")
flashgamepath1=Split(flashgamepath,"$")
body1=Split(body,"$")

if urlname="asp" then
url=curl&"&"&asppage&"="&EndPage
else
  if indexurl<>"" then
url=indexurl
  else
url=url1(0)&id&url1(1)
   end if
end if
                %><%
On Error Resume Next 
zlp=GetHttp(url) 


body=GetStr(zlp,body1(0),body1(1))
flashimg=GetStr(body,flashimg1(0),flashimg1(1))
flashimg=replace(flashimg,"..","")
flashimg=flashimgurl&flashimg
flashgamepath=GetStr(body,flashgamepath1(0),flashgamepath1(1))
flashpath=GetStr(body,flashpath1(0),flashpath1(1))
flashurl=flashgamepath&flashpath
flashname=GetStr(body,flashname1(0),flashname1(1))
flashname=replace(flashname," ")
flashabout=GetStr(body,flashabout1(0),flashabout1(1))
flashabout=replace(flashabout," ")

flashclass=GetStr(body,flashclass1(0),flashclass1(1))
flashclass=replace(flashclass," ")

flashsize=GetStr(body,flashsize1(0),flashsize1(1))
flashsize=replace(flashsize," ")

flashzz=GetStr(body,flashzz1(0),flashazz1(1))
flashzz=replace(flashzz," ")

flashtype=GetStr(body,flashtype1(0),flashtype1(1))
flashtype=replace(flashtype," ")

'关键字替换
set rs=server.CreateObject("ADODB.RecordSet")
Sql="Select * From gjz Where claid="&zdid
rs.Open Sql,conn1,0,3
do while not rs.eof
tfnr=rs("tfnr")
tfnr1=Split(tfnr,"$")
tfzdname=rs("tfzdname")
select case tfzdname
  case "gameimg"
      flashimg=replace(flashimg,tfnr1(0),tfnr1(1))
  case "gameabout"
      flashabout=replace(flashabout,tfnr1(0),tfnr1(1))
  case "gametype"
      flashtype=replace(flashtype,tfnr1(0),tfnr1(1))
end select
   rs.movenext
loop

rs.close
set fs=nothing
'下载图片
if Instr(flashimg,noflashimg) = False then
flashimgpath=replace(flashimg,flashimgurl,"")

dim fldr,GetNewsFold
fldr=""
If CheckDir1(flashimgpath)=false then 
GetNewsFold=split(flashimgpath,"/")
For i=0 to Ubound(GetNewsFold)-1

if fldr="" then
fldr=GetNewsFold(i)
else
fldr=fldr&"/"&GetNewsFold(i)
end if
If CheckDir1(fldr)=false then
 call MakeNewsDir1(fldr)
End if
next
flashimgpath=flashimgurl&flashimgpath
end if
end if
  dim fname
  fname = now()
  fname = replace(fname,"-","")
  fname = replace(fname," ","") 
  fname = replace(fname,":","")
  fname = replace(fname,"PM","")
  fname = replace(fname,"AM","")
  fname = replace(fname,"上午","")
  fname = replace(fname,"下午","")
  fname = int(fname) + int((10-1+1)*Rnd + 1)
  getPICurl=""&flashimgpath&""
  filename=year(now)&month(now)&day(now)
  fname1=fldr&"/"
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.folderexists(server.mappath("../comic_img/"&fldr&"\"&foldername))=false then
Fso.Createfolder(server.mappath("../comic_img/"&fldr&"\"&foldername))
end if
Set fso = nothing
path = "../comic_img/"&fname1
	temp=split(getPICurl,".")
	randomize
	ranNum=int(90000*rnd)+10000
	filename=id&".jpg"
       savepath = path&filename
       swf_Pic=""
	   if picpj="yes" then
 	   getPICurl="http://wenweb/admin/picpj.asp?url="&getPICurl
	   else
	   getPICurl=getPICurl
	   end if
       swf_Pic=saveimg(getPICurl,savepath)
       response.write "<font color=red>"&swf_Pic&"</font>&nbsp;图片保存成功<br>" &vbcrlf
       response.Flush
'===================================================
'开始写入记录
'===================================================
if datasave="yes" then
on error resume next

set rs=server.CreateObject("ADODB.RecordSet")
Sql="select * from zhangjie"
Rs.Open Sql,Conn,1,3
Rs.AddNew
  rs("comic_name")=comicname
  rs("comic_id")=comic_id
  rs("zj_name")=flashname
  rs("zjid")=fname
  rs("zj_s")=flashsize
  rs("pic_url")="comic_img/"&fname1
  rs("tpf")=0
  rs("add_date")=now()
  rs("hits")=0
  Rs.Update
Rs.Close
Set Rs = Nothing
else
Response.Write "数据库写入成功<br>"
end if
StarPage=flashsize
'on error resume next
RString=DeHttpdata(zlp,"'[^<>'']*','[^<>'']*','[^<>""]*'")
Response.Write "编号："&ID&"<br>"
response.flush
Response.Write "章节名称："&flashname&" <br>"
response.flush
Response.Write "图片总数:"&flashsize&"<br>"
response.flush
Response.Write "图片地址：<a href="&flashimg&" target=_blank>"&flashimg&"</a><br>"
response.flush
Response.write "<span id=last></span></td><td  valign=top><span id=showImport></span></td></tr></table>"
End Sub
Sub MakeNextPage
Response.write "<meta http-equiv=""refresh"" content=""0;url='cj.asp?curl="&curl&"&urlname="&urlname&"&claid="&zdid&"&save=no&StarPage="&StarPage&"&EndPage="&EndPage+1&"&Co="&Co+1&"&cjid1="&cjid1&"&cjid2="&cjid2&"&asppage="&asppage&"&comic_id="&comic_id&"&comicname="&comicname&"&picpj="&picpj&"'"">"
End Sub
Sub MakeNextzj
Response.write "<meta http-equiv=""refresh"" content=""0;url='cj.asp?curl="&curl&"&urlname="&urlname&"&claid="&zdid&"&save=yes&Co=0&cjid1="&cjid1+1&"&cjid2="&cjid2&"&comic_id="&comic_id&"&comicname="&comicname&"&asppage="&asppage&"&picpj="&picpj&"'"">"
End Sub
                %>
            </td>
        </tr>
    </table>
</body>
</html>
